﻿using System;
using System.Collections;

namespace ICommonLibrary.Collection {

    public static class HashtableExtension {

        public static object GetValueAddIfNotExist(this Hashtable table, object key, Func<object> func) {
            object v = table[key];
            if (v == null) {
                v = func();
                table[key] = v;
            }
            return v;
        }
         
    }
}